package kjd;

import static org.junit.Assert.assertTrue;
import kjd.test.RobotTestBed;
import robocode.BattleResults;
import robocode.control.events.BattleCompletedEvent;

/**
 * Illustrates JUnit testing of Robocode robots. This tests that GunAryos will gain more points with
 * bullets than ramming. Based on file provided by Philip Johnson. Modified for GunAryos and kjd
 * package.
 * 
 * @author Philip Johnson, Kendyll Doi
 * 
 */
public class TestGunAryosMostlyBulletPoints extends RobotTestBed {
  /**
   * Specifies that SittingDuck and GunAryos are to be matched up in this test case.
   * 
   * @return The comma-delimited list of robots in this match.
   */
  @Override
  public String getRobotNames() {
    return "sample.SittingDuck,kjd.GunAryos";
  }

  /**
   * This test runs for 10 rounds.
   * 
   * @return The number of rounds.
   */
  @Override
  public int getNumRounds() {
    return 10;
  }

  /**
   * The actual test, which asserts that GunAryos deals more bullet damage than ram damage in a
   * battle.
   * 
   * @param event Details about the ended turn.
   */
  @Override
  public void onBattleCompleted(BattleCompletedEvent event) {
    // Return the results in order of getRobotNames.
    BattleResults[] results = event.getIndexedResults();
    // Checks that GunAryos dealt RamDamage as part of battle strategy.
    assertTrue("GunAryos Ram Results has points.", results[1].getRamDamage() < results[1]
        .getBulletDamage());
  }
}
